import { FilmsApi } from "~/src/typings/service/filmsApi";
import { apiRequest } from "../request";

/**
 * fetchGetFilmsList 获取电影列表
 * @param searchForm 查询表单信息
 * @returns
 */
export function fetchGetFilmsList(searchForm?: FilmsApi.FilmsRequest){
  return  apiRequest.get<Service.ListResult<FilmsApi.FilmsRequest[]>>('/films', { params: searchForm });
}

/**
 * fetchCreateFilm 创建api
 * @param films 创建的表单信息
 * @returns
 */
export function fetchCreateFilm(films?: FilmsApi.FilmsRequest){
  return  apiRequest.post<any, FilmsApi.FilmsRequest>('/films/createFilm', films!);
}
/**
 * fetchDeleteFilm 删除电影
 * @param id 选中id
 * @returns
 */
export function fetchDeleteFilm(id: {id?: string}){
  return  apiRequest.post<any, { id?: string }>('/films/deleteFilm', id);
}
/**
 * fetchUpdateFilm 更新电影
 * @param films 修改电影信息
 * @returns
 */
export function fetchUpdateFilm(films?: FilmsApi.FilmsRequest){
  return  apiRequest.post<any, FilmsApi.FilmsRequest>('/films/updateFilm', films!);
}
